<%--
  Created by IntelliJ IDEA.
  User: lww
  Date: 2019/1/18
  Time: 20:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <script src="/layuiadmin/layui/layui.js" charset="utf-8"></script>
</head>
<body>
    <%--<h1>采购添加</h1>--%>
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">单据ID</label>
            <div class="layui-input-block">
                <input type="text" id="depoid" name="id" required  lay-verify="required" placeholder="请输入单据ID" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">类型(出库/入库)</label>
                <div class="layui-input-inline">
                    <input type="text" name="type" lay-verify="title" autocomplete="off" id="type" value="入库" disabled class="layui-input">
                </div>
                <label class="layui-form-label">出入库分类</label>
                <div class="layui-input-inline">
                    <input type="text" name="subtype" lay-verify="title" autocomplete="off" id="subtype" value="采购"  disabled class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">初始票据号</label>
                <div class="layui-input-inline">
                    <input type="text" name="defaultnumber" lay-verify="title" autocomplete="off" id="defaultnumber"  class="layui-input">
                </div>
                <label class="layui-form-label">票据号</label>
                <div class="layui-input-inline">
                    <input type="text" name="number" lay-verify="title" autocomplete="off" id="number"  class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">创建日期</label>
                <div class="layui-input-inline">
                    <input type="text" name="createtime" id="date" lay-verify="datetime" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input">
                </div>
            </div>
            <label class="layui-form-label">单据状态</label>
            <div class="layui-input-inline" >
                <select name="status" lay-verify="required" lay-search="" id="status">
                    <option value="" ></option>
                    <option value="false" >false</option>
                    <option value="true">true</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">

            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">供应商</label>
                <div class="layui-input-inline">
                    <select name="organid" lay-verify="required" lay-search="" id="organid">
                        <option value=""></option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="4">4</option>
                    </select>
                </div>
                <label class="layui-form-label">操作员</label>
                <div class="layui-input-inline">
                    <select name="operpersonname" lay-verify="required" lay-search="" id="operpersonname">
                        <option value=""></option>
                        <option value="季圣华">季圣华</option>
                        <option value="张三">张三</option>
                        <option value="李四">李四</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark" placeholder="请输入内容" id="remark" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit  lay-filter="demo1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    <%--<script src="//res.layui.com/layui/dist/layui.js" charset="utf-8"></script>--%>
    <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
    <script>
        layui.use(['form', 'layedit', 'laydate','layer','jquery'], function(){
            var form = layui.form
                ,layer = layui.layer
                ,layedit = layui.layedit
                ,laydate = layui.laydate
                ,$ = layui.jquery;

            //日期
            laydate.render({
                elem: '#date'
                ,type:'datetime'
            });
            laydate.render({
                elem: '#date1'
                ,type:'datetime'
            });

            //创建一个编辑器
            var editIndex = layedit.build('LAY_demo_editor');
            //监听提交
            form.on('submit(demo1)', function(data){
                layer.alert(JSON.stringify(data.field), {
                    title: '最终的提交信息'
                })

                window.opener=null;
                window.open('','_self');
                window.close();
                /**/
                var url="/depothead/insert";
                $.post(
                    url,
                    data.field,
                    function(data2){
                        alert(data2);
                        /*关闭当前弹窗*/
                        layer.closeAll();
                    }
                );
                return false;
            });
        });
    </script>
</body>
</html>
